#include "SetWidget.h"
#include <QHBoxLayout>
#include <QTimer>
#include <QLabel>
#include "Setting.h"

SetWidget::SetWidget(QWidget* parent )
	:QWidget(parent)
{
	setAttribute(Qt::WA_StyledBackground);
	setStyleSheet("background:rgba(255,0,0,0.7);border-radius:40px;");
	// setWindowFlags(Qt::FramelessWindowHint);
	QHBoxLayout* lo = new QHBoxLayout;
	setLayout(lo);
	m_bat = new QLabel(this);
	lo->addWidget(m_bat);

	m_timer = new QTimer(this);
	connect(m_timer, &QTimer::timeout, this, [=](){
			int cap = getBatCapacity();
			m_bat->setText(QString("BAT0: %1 %").arg(cap));

			});
}

SetWidget::~SetWidget()
{

}


void SetWidget::showEvent(QShowEvent*event)
{
	resize(200, 300);
	move(0,0);

	m_timer->start(1000);
	QWidget::showEvent(event);
}
